# coding=utf-8
#

"""
hiveon的统计数据
"""

from django.db import models

# dict_keys(['algos', 'coins', 'miners', 'gpu_brands', 'amd_models', 'nvidia_models', 'asic_models'])


class HiveonAlgo(models.Model):
    """ """
    name = models.CharField(max_length=64, verbose_name="名称")
    amount = models.FloatField(default=0, verbose_name="量")
    cur_date = models.DateField(verbose_name="统计日期")
    create_time = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")

    class Meta:
        ordering = ("-create_time",)
        verbose_name = "算法"
        verbose_name_plural = "算法管理"

    def __str__(self):
        return self.name


class HiveonCoin(models.Model):
    """ """
    name = models.CharField(max_length=64, verbose_name="币对")
    amount = models.FloatField(default=0, verbose_name="量")
    cur_date = models.DateField(verbose_name="统计日期")
    create_time = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")

    class Meta:
        ordering = ("-create_time",)
        verbose_name = "币对"
        verbose_name_plural = "币对管理"

    def __str__(self):
        return self.name


class HiveonMiner(models.Model):
    """ """
    name = models.CharField(max_length=64, verbose_name="矿工")
    amount = models.FloatField(default=0, verbose_name="量")
    cur_date = models.DateField(verbose_name="统计日期")
    create_time = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")

    class Meta:
        ordering = ("-create_time",)
        verbose_name = "矿工"
        verbose_name_plural = "矿工管理"

    def __str__(self):
        return self.name


class HiveonGPUBrand(models.Model):
    """ """
    name = models.CharField(max_length=64, verbose_name="GPU")
    amount = models.FloatField(default=0, verbose_name="量")
    cur_date = models.DateField(verbose_name="统计日期")
    create_time = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")

    class Meta:
        ordering = ("-create_time",)
        verbose_name = "GPU"
        verbose_name_plural = "GPU管理"

    def __str__(self):
        return self.name


class HiveonGModel(models.Model):
    """ """
    GTYPE_CHOICES = ((1, "AMD"),
                     (2, "NVIDIA"),
                     (3, "ASIC"))

    name = models.CharField(max_length=64, verbose_name="算法")
    amount = models.FloatField(default=0, verbose_name="量")
    cur_date = models.DateField(verbose_name="统计日期")
    gtype = models.IntegerField(choices=GTYPE_CHOICES, default=0, verbose_name="类型")
    create_time = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")

    class Meta:
        ordering = ("-create_time",)
        verbose_name = "算法模型"
        verbose_name_plural = "算法模型管理"

    def __str__(self):
        return self.name


